﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DAL_NhaSach;
using BLL_NhaSach;

namespace AppQlyNhaSach.LichSu
{
    public partial class frmLichSuNo : DevExpress.XtraEditors.XtraForm
    {
        LichSuNoBLL lsBLL;
        public frmLichSuNo()
        {
            InitializeComponent();
        }

        private void frmLichSuNo_Load(object sender, EventArgs e)
        {
            lsBLL = new LichSuNoBLL(Properties.Settings.Default.ConnectionStringUser);
            grdLichSu.DataSource = lsBLL.getAllData();
        }

        private void frmLichSuNo_FormClosing(object sender, FormClosingEventArgs e)
        {
            frmMainNS.isLSNo = false;
        }

        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            int id = int.Parse(gridView1.GetFocusedRowCellValue("MaLSN").ToString());
            LichSuNo ls =(LichSuNo)lsBLL.findObjects(id);
            txtTen.Text= ls.KhachHang.TenKH;
            txtNgay.Text=ls.NgayPS.ToShortDateString();
            txtNoBD.Text=ls.GiaTriDau.ToString();
            txtNoPS.Text=ls.GiaTriPS.ToString();
        }
    }
}